// 登录相关接口
import axios from '@/api/request/request'
import { registerMock } from '@/mock/login'

// 用户ID校验接口
const checkUser = (option: any) => {
  return axios.post('/auth/auth-server/user/checkUser', {
    ...option
  })
}

// 发送短信验证码
const sendMessage = (option: any) => {
  return axios.post('/auth/login/sendMessage', {
    ...option
  })
}

// 获取图片验证码
const getValidateCode = (option: any) => {
  return axios.get('/auth/login/getValidateCode', {
    ...option
  })
}

// 登录
const login = (option: any) => {
  return axios.post('/auth/login/loginByPassword', {
    ...option
  })
}

// 用户注册
const register = (option: any) => {
  return registerMock({
    ...option
  })
}

// 重置密码
const resetPassword = (option: any) => {
  return axios.post('/auth/login/forgotPassword', {
    ...option
  })
}

// 用户退出登录接口
const loginOut = () => {
  return axios.post('/auth/login/loginOut', {})
}

// 获取用户信息
const getUserInfo = (option: any) => {
  return axios.post('/auth/login/getUserInfo', {
    ...option
  })
}

export { checkUser, sendMessage, login, register, resetPassword, getValidateCode, loginOut, getUserInfo }
